<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/>
    <title>Documentation - Materialize</title>
    <!-- CSS  -->
    <link href="../../../bin/materialize.css" type="text/css" rel="stylesheet" media="screen,projection"/>
    <style>
        body, html,
        .section {
          height: 100%;
        }
        .wrapper {
          height: 100%;
          width: 100%;
          position: relative;
          overflow: hidden;
        }
        .table-of-contents li a {
          color: #fff;
        }
        .box {
          width: 50%;
          height: 50%;
          transform: translateX(-100%);
          background-color: #444;
          transition: transform .3s;
        }
        #green .box, #red .box {
          position: absolute;
          right: 0;
          transform: translateX(100%);
        }

        .scrolled .box,
        #green.scrolled .box, #red.scrolled .box {
          transform: translateX(0);
        }
    </style>
  </head>
  <body>

    <div id="blue" class="section scrollspy blue">
      <div class="wrapper">
        <div class="box"></div>
      </div>
    </div>
    <div id="green" class="section scrollspy green">
      <div class="wrapper">
        <div class="box"></div>
      </div>
    </div>
    <div id="yellow" class="section scrollspy yellow">
      <div class="wrapper">
        <div class="box"></div>
      </div>
    </div>
    <div id="red" class="section scrollSpy red">
      <div class="wrapper">
        <div class="box"></div>
      </div>
    </div>


    <div class="stats" style="position: fixed; top: 50%; left: 50%; width: 100px; margin-left: -50px;">
      <strong>scrollTop:&nbsp;</strong><span id="scrollTop">0</span>
    </div>

    <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
    <script src="../../../bin/materialize.js"></script>

    <script type="text/javascript">
      $( document ).ready(function() {

        var options = [
          {selector: '#blue', offset: 50, callback: function(el) {
            $(el).addClass('scrolled');
          } },
          {selector: '#green', offset: 50, callback: function(el) {
            $(el).addClass('scrolled');
          } },
          {selector: '#yellow', offset: 50, callback: function(el) {
            $(el).addClass('scrolled');
          } },
          {selector: '#red', offset: 50, callback: function(el) {
            $(el).addClass('scrolled');
          } },
        ];
        Materialize.scrollFire(options);

        $(window).on('scroll', function() {
          $('#scrollTop').text($(window).scrollTop());
        });
      });

    </script>
  </body>
</html>